import request from '@/utils/request'
import { IPermissionParam, IPermissionResponse } from './type'
import { IResponseBase } from '@/api/user/type'

export const reqAllPremission = () =>
  request.get<any, IPermissionResponse>('/admin/acl/permission')

export const reqAddPremission = (param: IPermissionParam) => {
  if (param.id) {
    return request.put<any, IResponseBase>(
      '/admin/acl/permission/update',
      param,
    )
  } else {
    return request.post<any, IResponseBase>('/admin/acl/permission/save', param)
  }
}

export const reqDeleteMenu = (id: string) =>
  request.delete<any, IResponseBase>(`/admin/acl/permission/remove/${id}`)
